//
//  UIViewController+BaseViewController.m
//  ReviewDemo
//
//  Created by 龙 on 2018/3/24.
//  Copyright © 2018年 long. All rights reserved.
//

#import "UIViewController+BaseViewController.h"
#import "NSObject+Swizzling.h"
#import <objc/runtime.h>

@implementation UIViewController (BaseViewController)

+ (void)load
{
    NSLog(@"----------- UIViewController (BaseViewController) ---------------");

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{

        [self methodSwizzlingWithOriginalSelector:@selector(loadView) bySwizzledSelector:@selector(ll_LoadView)];
        [self methodSwizzlingWithOriginalSelector:@selector(viewDidLoad) bySwizzledSelector:@selector(ll_ViewDidLoad)];

    });
}

- (void)ll_LoadView
{
    [self ll_LoadView];
    self.view.backgroundColor = [UIColor whiteColor];
}

- (void)ll_ViewDidLoad
{
    [self ll_ViewDidLoad];
    
    // 此处不能调用 self.view？ 为何？
    
    
    
    
//    NSLog(@"self.navigationItem ---%@",self.navigationItem);
    
//    NSLog(@"self.navigationItem.backBarButtonItem ---%@",self.navigationItem.backBarButtonItem);

//    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"navigationItemBack"] style:UIBarButtonItemStylePlain target:self action:@selector(backClick)];
    
//    id value = [self.navigationItem valueForKey:@"_abbreviatedBackButtonTitles"];
//    if (value && [value isKindOfClass:[NSArray class]])
//    {
//        [self setValue:@[@"",@"navigationItemBack"] forKeyPath:@"self.navigationItem.abbreviatedBackButtonTitles"];
//    }

}



@end
